<?php
namespace Home\Controller;
use Think\Controller;
class FormController extends Controller{
      /*public function insert(){
        $Form   =   D('Form');
        if($Form->create()) {
            $result =   $Form->add();
            if($result) {
                $this->success('数据添加成功！');
            }else{
                $this->error('数据添加错误！');
            }
        }else{
            $this->error($Form->getError());
        }
    }*/
    //判断验证码是否有误
      public function insert(){
        $code = I('post.vcode');
        $verify = new \Think\Verify();
        $ret = $verify->check($code);
        if(!$ret){
            $this->error('验证码错误');
        }
        $db = M('Form');
        $data['title'] = I('post.title');
        $data['content'] = I('post.content');
        $data['create_time'] = time();
        $db->add($data);
        //验证码样式
        $Verify->fontSize = 30;
        $Verify->length   = 5;
        $Verify->useNoise = false;
        $Verify->useImgBg = true; 
        $Verify->entry();
        }
    }